/*
 * 
 * Libman
 * 
 * Daniel Kaufmann, Martin Lang, Simon Moosbrugger,
 * Stefan Mayer, Stephan Halbeisen
 * 
 */
package model.dao;

import hibernate.HibernateUtil;
import model.Exemplar;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

/**
 * A DAO implementation for Exemplar objects.
 */

public class ExemplarDAO extends GenericHibernateDAO<Exemplar, Long> {
	// implementation in parent class
	/**
	 * Search exemplar.
	 * 
	 * @param invno
	 *            the invno
	 * @return the exemplar
	 */
	public Exemplar searchExemplar(String invno) {
		Session session = HibernateUtil.currentSession();
		Criteria crit = session.createCriteria(Exemplar.class);

		crit.add(Restrictions.eq("invno", invno));

		return (Exemplar) crit.list().get(0);
	}
}